import { HttpMethod } from '@/services/types';
import { request } from '@/api/request';

/**
 * GET /follow/:id 关注列表
 * @param id
 * @param options
 */
export async function resFollow(id: number, options?: { [key: string]: any }) {
  return request<API.PaginationResult<API.FollowStruct>>('/follow/' + id, {
    method: HttpMethod.GET,
    ...(options || {}),
  });
}

/**
 * GET /follow/fan/:id 粉丝列表
 * @param id
 * @param options
 */
export async function resFan(id: number, options?: { [key: string]: any }) {
  return request<API.PaginationResult<API.FollowStruct>>(
    '/follow/fan/' + id,
    {
      method: HttpMethod.GET,
      ...(options || {}),
    },
  );
}

/**
 * POST /follow/:id 关注和取消
 * @param id
 * @param options
 */
export async function resAddOrCancelFollow(
  id: number,
  options?: { [key: string]: any },
) {
  return request<R<API.FollowStruct>>('/follow/' + id, {
    method: HttpMethod.POST,
    ...(options || {}),
  });
}

/**
 * GET /follow/is/:id 是否关注
 * @param id
 * @param options
 */
export async function resIsFollow(
  id: number,
  options?: { [key: string]: any },
) {
  return request<API.FollowStruct>('/follow/is/' + id, {
    method: HttpMethod.GET,
    ...(options || {}),
  });
}
